import { Message } from '@arco-design/web-react';

/**
 * @description: Verify network request status code
 * @param {Number} status
 * @return void
 */
export const checkStatus = (status: number) => {
  switch (status) {
    case 400:
      Message.error('Request failed! Please try again later');
      break;
    case 401:
      Message.error('Login invalid! Please log in again');
      break;
    case 403:
      Message.error('The current account does not have permission to access');
      break;
    case 404:
      Message.error('The resource you are accessing does not exist');
      break;
    case 405:
      Message.error('Request timed out! Please try again later');
      break;
    case 408:
      Message.error('Request timed out! Please try again later');
      break;
    case 500:
      Message.error('Exceptional service');
      break;
    case 502:
      Message.error('Gateway error');
      break;
    case 503:
      Message.error('service is not available');
      break;
    case 504:
      Message.error('Request failed');
      break;
    default:
      Message.error('Request failed! Please try again later');
  }
};
